package com.glodon.paas.job.qto.dao;

import java.net.UnknownHostException;
import java.util.Date;

import org.junit.Ignore;
import org.junit.Test;
import org.springframework.data.mongodb.core.MongoOperations;
import org.springframework.data.mongodb.core.MongoTemplate;

import com.glodon.paas.qto.model.Job;
import com.glodon.paas.qto.model.Task;
import com.mongodb.Mongo;
import com.mongodb.MongoException;

public class JobRepositoryIT {

    @Test
    @Ignore
    public void testSaveJob() throws UnknownHostException, MongoException {
        MongoOperations mongoOps = new MongoTemplate(new Mongo(), "job");
        Job job = new Job();
        job.setName("test");
        job.setInput("http://localhost");
        job.setStartTime(new Date());
        job.setStories("1,2,3");
        mongoOps.save(job);
        mongoOps.dropCollection("job");
    }

    @Test
    @Ignore
    public void testSaveTask() throws UnknownHostException, MongoException {
        MongoOperations mongoOps = new MongoTemplate(new Mongo(), "job");
        Task task = new Task("test", "123", "parentId", "abc", "1,2,3", true, 3);
        mongoOps.save(task);
        mongoOps.dropCollection("task");
    }

}
